package com.i2works.smartluolong.utils.base;

import java.util.Objects;

/**
 * 个人事项类型标识
 *
 * @author Liu Yutao <koal@vip.qq.com>
 * @date 2018/3/23 15:02
 */

public enum PersonalItemTypeEnum {
    LAONIAN("laonian", "老年优待证", LeaderEnum.MINZHEN.getName()),
    LAONIAN_CARD("laonianCard", "老年优待证", LeaderEnum.MINZHEN.getName()),
    DANSHEN("danshen", "无婚姻登记记录证明", LeaderEnum.MINZHEN.getName());

    PersonalItemTypeEnum(String key, String value, String leader) {
        this.key = key;
        this.value = value;
        this.leader = leader;
    }

    private String key;
    private String value;
    private String leader;

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    // 根据value返回枚举类型,主要在switch中使用
    public static PersonalItemTypeEnum getByValue(String value) {
        for (PersonalItemTypeEnum flowItemTypeEnum : values()) {
            if (Objects.equals(flowItemTypeEnum.getKey(), value)) {
                return flowItemTypeEnum;
            }
        }
        return null;
    }

}
